from kingadmin.admin_base import BaseAdmin
from kingadmin.sites import site
from crm import models

class CustomerAdmin(BaseAdmin):
    list_display = ['id','name','source','contact_type','contact','consultant','consult_content','status','date']
    list_filter = ['source','consultant','status','date']
    search_fields = ['contact','consultant__name','name','source','status']
    readonly_fields = ['status','name']
    filter_horizontal=['consult_courses']
    actions=['chang_status']
    def chang_status(self,request,queryset):
        queryset.update(status=2)

site.register(models.CustomerInfo,CustomerAdmin)
site.register(models.Role)
site.register(models.Menus)
site.register(models.UserProfile)